<?php

namespace maotool\util;

use maotool\match\AntPathMatcher;

/**
 * Ant 风格路径模式匹配工具
 */
class AntPathMatcherUtil
{

    /**
     * 是否需要模式匹配
     * @param $path
     * @return bool
     */
    public static function isPattern($path)
    {
        $antPathMatcher = new AntPathMatcher();
        return $antPathMatcher->isPattern($path);
    }

    /**
     * 模式匹配
     * @param $pattern
     * @param $path
     * @return bool
     */
    public static function match($pattern, $path)
    {
        $antPathMatcher = new AntPathMatcher();
        return $antPathMatcher->match($pattern, $path);
    }

    /**
     * 模式匹配 全值匹配
     * @param $pattern
     * @param $path
     * @return bool
     */
    public static function matchStart($pattern, $path)
    {
        $antPathMatcher = new AntPathMatcher();
        return $antPathMatcher->match($pattern, $path);
    }

}